package com.chenfy.everysound.ui.main

import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.chenfy.everysound.entity.SoundData


/**
 * A [FragmentPagerAdapter] that returns a fragment corresponding to
 * one of the sections/tabs/pages.
 */
class SectionsPagerAdapter(private val context: Context, fm: FragmentManager)
    : FragmentPagerAdapter(fm) {

    override fun getItem(position: Int): Fragment {
        return SoundFragment.newInstance(position )
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return SoundData.soundEntity[position].label
    }

    override fun getCount(): Int {
        // Show 2 total pages.
        return SoundData.soundEntity.size
    }
}